home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_enscript.idb / usr / freeware / share / enscript / hl / vrml.st.z / vrml.st
Encoding:
Text File  |  2002-04-08  |  3.3 KB  |  112 lines

  1. /**
  2.  * Name: vrml
  3.  * Description: Virtual Reality Modeling Language (VRML97)
  4.  *
  5.  *   Typesets UTF-8 encoded VRML files including inline scripts
  6.  *   (JavaScript or VrmlScript) using Encript's JavaScript mode.
  7.  *
  8.  *   Note: Some VRML browsers allow use of double quotes in
  9.  *   defining string literals inside inlined scripts.  Doing so
  10.  *   breaks the logic programmed here.  Using single quotes
  11.  *   (i.e. ECMAScript spec-compliant string literals) works fine.
  12.  *
  13.  * Author: James S°rlie <sorliej@imm.dtu.dk>
  14.  */
  15.  
  16. state vrml extends HighlightEntry
  17. {
  18.   BEGIN {
  19.     require_state (javascript);
  20.   }
  21.  
  22.   /* Comments. */
  23.   /#/ {
  24.     comment_face (true);
  25.     language_print ($0);
  26.     call (eat_one_line);
  27.     comment_face (false);
  28.   }
  29.  
  30.   /* Inline Script Protocols. */
  31.   /\"javascript:|\"vrmlscript:/ {
  32.     reference_face (true);
  33.     language_print ($0);
  34.     reference_face (false);
  35.     from_vrml = 1;
  36.     call (javascript_internal);
  37.   }
  38.  
  39.   /* String constants. */
  40.   /\"/ {
  41.     string_face (true);
  42.     language_print ($0);
  43.     call (c_string);
  44.     string_face (false);
  45.   }
  46.  
  47.   /* UTF-8 header text. */
  48.   /^#VRML V2.0/ {
  49.     reference_face (true);
  50.     language_print ($0);
  51.     call (eat_one_line);
  52.     reference_face (false);
  53.   }
  54.  
  55.   /* Built-ins nodes:
  56.      http://www.vrml.org/Specifications/VRML97/part1/nodesRef.html
  57.  
  58.      (build-re '(Introduction Anchor Appearance AudioClip Background
  59.      Billboard Box Collision Color ColorInterpolator Cone Coordinate
  60.      CoordinateInterpolator Cylinder CylinderSensor DirectionalLight
  61.      ElevationGrid Extrusion Fog FontStyle Group ImageTexture
  62.      IndexedFaceSet IndexedLineSet Inline LOD Material MovieTexture
  63.      NavigationInfo Normal NormalInterpolator OrientationInterpolator
  64.      PixelTexture PlaneSensor PointLight PointSet PositionInterpolator
  65.      ProximitySensor ScalarInterpolator Script Shape Sound Sphere
  66.      SphereSensor SpotLight Switch Text TextureCoordinate TextureTransform
  67.      TimeSensor TouchSensor Transform Viewpoint VisibilitySensor
  68.      WorldInfo))
  69.   */
  70.   /\b(A(nchor|ppearance|udioClip)|B(ackground|illboard|ox)\
  71. |C(o(l(lision|or(|Interpolator))|ne|ordinate(|Interpolator))\
  72. |ylinder(|Sensor))\
  73. |DirectionalLight|E(levationGrid|xtrusion)|Fo(g|ntStyle)|Group\
  74. |I(mageTexture|n(dexed(FaceSet|LineSet)|line|troduction))|LOD\
  75. |M(aterial|ovieTexture)|N(avigationInfo|ormal(|Interpolator))\
  76. |OrientationInterpolator\
  77. |P(ixelTexture|laneSensor|o(int(Light|Set)|sitionInterpolator)\
  78. |roximitySensor)\
  79. |S(c(alarInterpolator|ript)|hape|ound|p(here(|Sensor)|otLight)|witch)\
  80. |T(ext(|ure(Coordinate|Transform))|imeSensor|ouchSensor|ransform)\
  81. |Vi(ewpoint|sibilitySensor)|WorldInfo)\b/ {
  82.     builtin_face (true);
  83.     language_print ($0);
  84.     builtin_face (false);
  85.   }
  86.  
  87.   /* Keywords.
  88.      http://www.vrml.org/Specifications/VRML97/part1/grammar.html#TableA.1 */
  89.   /\b(DEF|EXTERNPROTO|FALSE|IS|NULL|PROTO|ROUTE|T(O|RUE)|USE|\
  90. e(vent(In|Out)|xposedField)|field)\b/ {
  91.     keyword_face (true);
  92.     language_print ($0);
  93.     keyword_face (false);
  94.   }
  95.  
  96.   /* Types.
  97.      http://www.vrml.org/Specifications/VRML97/part1/grammar.html#Fields */
  98.   /\b(MF(Color|Float|Int32|Node|Rotation|String|Time|Vec(2f|3f))|\
  99. SF(Bool|Color|Float|Image|Int32|Node|Rotation|String|Time|Vec(2f|3f)))\b/ {
  100.     type_face (true);
  101.     language_print ($0);
  102.     type_face (false);
  103.   }
  104. }
  105.  
  106.  
  107. /*
  108. Local variables:
  109. mode: c
  110. End:
  111. */
  112.